<template>
  <div class="main_container">
    <el-container class="mainDiv">
      <el-main style="margin-top: 60px;">
        <span style="color: rgb(245, 108, 108)">
          {{ disposalStat === '5' ? '*拍卖需要填写每个物品的处置金额并核对物品数量' : '*请核对物品的处置数量' }}
        </span>
        <el-table class="mt10" :data="proList" border stripe>
          <el-table-column label="物品编号" prop="proNo" align="center" width="240"/>
          <el-table-column label="物品名称" prop="proName" align="center" min-width="200"/>
          <el-table-column label="处置数量" prop="applyNumber" align="center" min-width="80"/>
          <el-table-column v-if="disposalStat ==='5'" label="处置金额" align="center" min-width="220">
            <template slot-scope="scope">
              <el-input-number :controls="false" style="width: 80%" v-model="scope.row.disposalAmount"/>
            </template>
          </el-table-column>
        </el-table>
      </el-main>
      <el-footer>
        <el-button :disabled="buttonLoading" @click="$emit('previous')" type="primary">上一步</el-button>
        <el-button :disabled="buttonLoading" @click="submit" type="primary">提交</el-button>
      </el-footer>
    </el-container>
  </div>
</template>

<script>
export default {
  name: 'proForm',
  props: {
    disposalStat: {
      type: [String, Number]
    },
    proList: {
      type: Array
    }
  },
  data() {
    return {
      buttonLoading: false
    }
  },
  methods: {
    submit() {
      if (this.disposalStat === '5') {
        const filter = this.proList.filter(({ disposalAmount }) => disposalAmount === undefined)
        if (filter && filter.length) {
          return this.$message.info('请填写财物的处置金额')
        }
      }
      this.$emit('submit')
    }
  }
}
</script>

<style scoped>

</style>
